<%= render :partial=> 'layouts/datatable'%>
<table id="list_table" cellpadding="5" cellspacing="0" border="2" width="100%">
  <thead>
    <tr>
      <th>Name</th>
      <th>Email Address</th>
      <th>Gender</th>
      <th>Birthday</th>
      <th>ssn</th>
      <th>Physical address</th>
      <th>Mailing address</th>
      <th>Phone number</th>
      <th>Prefrence contact medium</th>
      <th>Prefrence contact time</th>
      <th>Refrence source</th>
      <th>Active</th>
    
    </tr>
  </thead>
    <tbody>
    <% @clients.each do |client| %>
      <tr>
        <td><%= client.full_name  %></td>
        <td><%= client.email  %></td>
        <td><%= client.gender  %></td>
        <td><%= client.birthday  %></td>
        <td><%= client.ssn  %></td>
        <td><%= client.street_address  %></td>
        <td><%= client.mailing_street_address  %></td>
        <td><%= client.phone_number  %></td>
        <td><%= client.pref_contact_medium  %></td>
        <td><%= client.pref_contact_time  %></td>
        <td><%= client.ref_source  %></td>
        <td style="cursor:pointer;" onclick="javascript:toggle_status(<%= client.id %>);" id = active_status<%= client.id  %> ><%= client.is_active.to_s.humanize  %></td>
        
      </tr>
    <% end %>
    </tbody>
</table>

<script>
function toggle_status(id){
  $('#active_status'+id).load('/change_active_status/'+id +'/client #active_status');
}
</script>


